﻿using System.Windows.Forms;
using Editor.Properties;

namespace Editor
{
    /// <summary>
    /// Form To set object id upon inital creation.
    /// </summary>
    public sealed partial class ObjectIdSetterForm : Form
    {
        public ObjectIdSetterForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Gets the id for the object.
        /// </summary>
        public int Id
        {
            get { return int.Parse(idTxbx.Text); }
        }

        private void okBtn_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(idTxbx.Text))
            {
                MessageBox.Show(Resources.EnterObjectIdPrompt, Name);
                return;
            }

            int res = 0;
            if (!int.TryParse(idTxbx.Text, out res))
            {
                MessageBox.Show(Resources.NumericValuesOnlyWarning, Name);
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
    }
}